import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useLoginStore = defineStore(
  'login',
  () => {
    const loginInfo = ref(null)
    const setLoginInfo = (loginResult) => {
      loginInfo.value = loginResult
    }
    const clearLoginInfo = () => {
      loginInfo.value = null
    }

    return {
      loginInfo,
      setLoginInfo,
      clearLoginInfo,
    }
  },
  {
    persist: {
      storage: sessionStorage,
    }
  },
)
